<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script language="JavaScript" src="scripts/ts_picker.js"></script>
<style type="text/css">
.style3 {
	height: 23px;
}

#Select1 {
	width: 176px;
}

.style4 {
	width: 187px;
	height: 26px;
}

.style5 {
	height: 26px;
}

.style6 {
	height: 80px;
}

#Reset1 {
	width: 66px;
}

#Submit1 {
	width: 65px;
}

#TextArea1 {
	width: 571px;
	height: 67px;
}
</style>
<title>Apply For Leave</title>


 <script type="text/javascript">
 



function checkapplydata(){

var d1=document.leaveform.startdate.value;
var dd1=parseInt(d1.replace(/-/g,""));
var d2=document.leaveform.enddate.value;
var dd2=parseInt(d2.replace(/-/g,""));
var now=new Date();
var nowint=now.getYear()*10000+(now.getMonth()+1)*100+now.getDate();


if((document.leaveform.leavetype[0].checked == false)&&(document.leaveform.leavetype[1].checked == false)&&(document.leaveform.leavetype[2].checked == false))
{
alert("please choose leave type");
return false;
}



if(d1==""){
alert("Please select start date");
return false;}
if(d2==""){
alert("Please select end date");
return false;}
if(dd1>dd2){
alert("End date must later than start date");
return false;
}
if(dd1<nowint){
alert("Start date can't earlier than now");
return false;
}


if(document.leaveform.comment.value==""){
alert("please leave reason");
return false;
}





return true;

}
  

  
  
  
  </script>




</head>
<body>
	<h1>Leave Application</h1>
	<div style="height: 119px; margin-left: 1px">
        <h1 style="text-align: center">
            Leave Application</h1><div id="sidebar1" style="width: 199px; height: 266px">
	<h2>Menu</h2>
	
	<p><a href="LeaveApplyJSP.jsp">Apply Leave</a></p>
	<p style="width: 202px; "><a href="PersonalLeaveHistory.jsp">View Personal Leave History</a></p>
	<p><a href="PersonalLeaveUpdate.jsp">Edit Leave(s)</a></p>
	
	<p><a href="LogoutServlet.jsp">Logout</a></p>
  	<!-- end #sidebar1 --></div>
        </div>
        <div style="margin-left: 248px; height: 379px; width: 496px;"><div>
	
	<form id="leaveform" action="ApplyLeaveServelet.java" method="POST" name="tstest" onSubmit="return checkapplydata();">
		<table cellpadding=4 cellspacing=2 border=0>
			<tr>
				<td class="style4">Employee Name:</td>
				<td>
                <label>${sessionScope.user.name}</label>
               </td>
			</tr>
			<tr>
				<td class="style4">Leave Type:</td>
				<td class="style5"><input name="leavetype" type="radio"
					value="Annual">Annual <br> <input name="leavetype"
					type="radio" value="Medical">Medical <br> <input
					name="leavetype" type="radio" value="compensation">
					Compensation</td>
			</tr>
			<tr>
				<td class="style3">Start Date:</td>
				<td class="style3">
				<input name="startdate" type="text" value =""/>
				<a href="javascript:show_calendar('document.tstest.startdate', document.tstest.startdate.value);"><img src="/images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a>
				</td>
			</tr>
			<tr>
				<td>End Date:</td>
				<td>
				<input name="enddate" type="text" />
                <a href="javascript:show_calendar('document.tstest.enddate', document.tstest.enddate.value);"><img src="/images/cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a>
</td>
			</tr>
			<tr>
				<td>Leave Period:</td>
				<td class="style3"><input name="leaveperiod" id="leaveperiod" type="Text" /></td>
			</tr>
			<tr>
				<td class="style6">Reason:</td>
				<td class="style6"><textarea id="comment" name="comment" style="width: 443px; "></textarea>
				</td>
			</tr>

			<tr>
				<td class="style3">Work Dissemination:</td>
				<td class="style3"><input name="workdissemination" id="workdissemination" type="text" />
				</td>
			</tr>
			<tr>
				<td class="style3">ContactDetail:</td>
				<td class="style3"><input name="contactdetail" id="contactdetail" type="text" />
				</td>
			</tr>
			<tr>
				<td><input name="Submit" id="Submit" type="submit" value="submit" />
				</td>
				<td><input name="Reset" id="Reset" type="reset" value="reset" />
				</td>
			</tr>
		</table>
	</form></div></div>>



</body>
</html>